typeof-->可以查出型別
let a = 1 ;
undefined
a
1
typeof a
"number"
a的型別是"number"
let milkPrice = 30;
let milkNum = 5 ;
let totle = milkPrice * milkNum ;
totle
150
總共是150
ex:anita身上有200元,經過清心飲料店,想買飲料給家人喝,一杯無糖少冰烏龍綠茶30元,一杯無糖少冰養樂多綠茶45元,兩杯無糖少冰青茶30元,請問anita還剩多少錢?
1.anita身上有200元
2.烏龍綠茶30元
3.養樂多綠茶45元
4.青茶30元
5.烏龍綠茶一杯
6.養樂多綠茶一杯
7.青茶兩杯
let anitaMoney = 200 ;
let OolongteaPrice = 30 ;
let YakultgreenteaPrice = 45 ;
let Greenteaprice = 30 ;
let OolongteaNum = 1 ;
let YakultgreenteaNum = 1 ;
let GreenteaNum = 2 ;
let leftMoney = anitaMoney-(OolongteaPrice * OolongteaNum)-(YakultgreenteaPrice * YakultgreenteaNum)-(Greenteaprice * GreenteaNum) ;
ans:leftMoney = 65